<div class="bjui-pageContent tableContent">
<form action="__URL__/handle/navTabId/{:CONTROLLER_NAME}" class="pageForm" data-toggle="validate">
    <input type="hidden" name="order_id" value="{$id}">
    <input type="hidden" name="uid" value="{$list.uid}">
        <div class="pageFormContent" data-layout-h="0">
          <table class="table table-bordered table-striped table-hover">
           <tbody>
        <Tr><td style="text-align:Center" colspan="2"><h3>请准确核实信息</h3></td></tr>
		    <tr><td><label class='control-label x85'>借款人:</label>{$list.user_name}</td><td><label  class='control-label x85'>订单号:</label>{$list.order_id}</td></tr>
        <tr><td><label for='uname_input' class='control-label x85'>借款金额:</label>{$list.money}元</td><td><label for='type_input' class='control-label x85'>手机号:</label>{$list.mobile_phone}</td></tr>
        <tr><td><label for='uname_input' class='control-label x85'>到期还款:</label>{$list.repayment_amount}元</td><td><label for='type_input' class='control-label x85'>剩余天数:</label>{:round(($list['expire_time']-time())/86400)}</td></tr>
        <tr><td><label for='content_input' class='control-label x85'>借款时间:</label>{:date('Y-m-d H:i:s',$list['creat_time'])}</td><td><label for='viewtime_input' class='control-label x85'>还款时间:</label>{:date('Y-m-d H:i:s',$list['expire_time'])}</td></tr>
        <tr><td>
        <label for='content_input' class='control-label x85'>操作选择:</label><select name="dotype" id="dotype"><option value="1">确认还款</option><option value="2">订单续期</option></select></td><td><label for='content_input' class='control-label x85'>交易时间:</label><input type='text' data-toggle='datepicker' data-pattern='yyyy-MM-dd HH:mm:ss' id='time2' name='k_time'  data-rule='datetime' size='20' value='{:date('Y-m-d H:i:s')}'>&nbsp;&nbsp;&nbsp;<span style="color:#DCDCDC;font-size: 12px">默认当前时间，请准确选择时间！！</span></td></tr>
         
        <TR style="display: none" id="day"><td><label for='viewtime_input' class='control-label x85'>续期时间:</label><select name="days"><option value="7" selected="true">7天</option>
        <!-- <option value="14">14天</option> -->
        </select></td><td><label for='viewtime_input' class='control-label x85'>续期金额:</label><input type="text" name="money"  value="{:$list['repayment_amount'] - $list['money'] + C('RENEWAL_AMOUNT')}" readonly="readonly" size="10px">&nbsp;&nbsp;&nbsp;<input type="text" name="truemoney" value="" size="10px" placeholder="实付" >元<span style="color:#DCDCDC;font-size: 12px" id="notice" true="true">请核对金额确保准确无误！！</span></td></tr>

        <TR id="all"><td><label for='viewtime_input' class='control-label x85'>是否全款:</label>
        <input type="radio" name="all" value="1" checked="true">全款 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="all" value="0">折扣
        </td><td><label for='viewtime_input' class='control-label x85'>应还金额:</label><input type="text" name="shouldmoney" min="0" value="{$list.repayment_amount}" readonly="readonly" size="10px">&nbsp;&nbsp;&nbsp;<span id="still"></span><span style="color:#DCDCDC;font-size: 12px;">请确保金额准确无误！！</span></td></tr>
        </tbody>
        </table>
        </div>
  </form>
</div>
<div class="bjui-pageFooter">
    <ul>
       <li><button type="button" class="btn-close" data-icon="close">取消</button></li>
       <li><button type="submit" class="btn-default" data-icon="save">确认</button></li>
    </ul>
</div>
<script type="text/javascript">
$("#dotype").change(function(){
   if($(this).val()==2){
      $("#day").show();
      $("#all").hide();
      notice( $("input[name=order_id]").val() );
   }else{
      $("#day").hide();
      $("#all").show();
   }
})

$("input[name=all]").click(function(){
   var type = $(this).val();
   if(type == 1){
       $("#still").html('');
   }else{
      var str = '<input class="form-control" type="text" name="discount"  value="" size="10px" placeholder="实付" date-rule="required">元';
       $("#still").html(str);
   }
   
})

function notice( order_id ){

  notice   = $("#notice");
  var type = notice.attr('true');
  if( type == 'true' ){

    $.ajax({
           type:'POST',
           data: {
              order_id:order_id
           },
           url:'{:U("order/transactionType")}',
           dataType:"json",

           success:function( msg ){

                if( msg ){
                    notice.html('今日已有交易，请谨慎操作！').css('color','red').css('font-size','24');
                }
                notice.attr('true','false');
           },error:function(){
               alert('网络错误！');
           }
    })
    
  }
}

</script>